package com.founder.tool.xml;

import java.io.IOException;

import org.xml.sax.SAXException;

public class Xml2Entity {
	
	private String xml;
	
	private EntityHandler handler;
	
	public Xml2Entity(String xml) {
		this.xml = xml;
		handler = null;
	}
	
	public Object getResult() {
		if (handler != null) {
			return handler.getResult();
		}
		handler = new EntityHandler();
		try {
			new XmlUtil().parse(xml, handler);
		} catch (IOException e) {
			e.printStackTrace();
		} catch (SAXException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return handler.getResult();
	}

}
